import React from 'react'
import {HashRouter as Router, Route, Switch} from 'react-router-dom'
import Main from './Main'
import About from './../route1/about'
import Topic from './../route1/topic'
import Home from './Home'

export default class IRouter extends React.Component{
    render(){
        return(
            <Router>
                <Home>
                    {/* 嵌套路由的实现 render方法
                        render()=> 默认有个return方法 */}
                <Route path="/main" render={()=>
                    <Main>
                        <Route path="/main/a" component={About}></Route>
                    </Main>
                }></Route>
                <Route path="/about" component={About}></Route>
                <Route path="/topics" component={Topic}></Route>
                </Home>
            </Router>
        );
    }
}